<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<jsp:useBean id="expressionMap" scope="page" class="cn.sumpu.app.guoguojie.domain.Ext.Expression" />
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>

<script type="text/javascript">

//记录光标的地方，从光标的地方插入
(function($){
	$.fn.extend({
		insertAtCaret: function(myValue){
			var $t=$(this)[0];
			if (document.selection) {
				this.focus();
				sel = document.selection.createRange();
				sel.text = myValue;
				this.focus();
			}
			else 
				if ($t.selectionStart || $t.selectionStart == '0') {
					var startPos = $t.selectionStart;
					var endPos = $t.selectionEnd;
					var scrollTop = $t.scrollTop;
					$t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length);
					this.focus();
					$t.selectionStart = startPos + myValue.length;
					$t.selectionEnd = startPos + myValue.length;
					$t.scrollTop = scrollTop;
				}
				else {
					this.value += myValue;
					this.focus();
				}
		}
	})	
})(jQuery);

	//表情小试牛刀
	function showExpression(self){
		$(self).parent().find("#expression_all").show();
		//鼠标离开后表情隐藏
		$(self).parent().mouseleave(function(){
			$(self).parent().find("#expression_all").hide();
		});
	}
	
	//添加表情
	function addExpression(self){
		$(self).parent().parent().parent().parent().parent().parent().find("#textarea_content").insertAtCaret(self.alt);
	}
	
</script>
	
		<ul id="expression_leave" style="float: left;">
          <li class="h_bq" style="position: relative;z-index: 100;border: 0;padding: 0 5px;"><a href="javascript:void(0);" onclick="showExpression(this)" >
          <img src="images/home_images/ico14.png" alt="表情" />表情</a>
            <div class="h_bqText" style="display:none;" id="expression_all" >
              <div class="h_bqText_bg"></div>
              <div class="h_bqText_img">
              <c:forEach items="${pageScope.expressionMap.expressionMap }" var="e">
              	<img src="images/expression/${e.key }" style="cursor: pointer;"
              	 title="${e.value }" onclick="addExpression(this)" alt="${e.value }" />
              </c:forEach>
              </div>
              <%--
              <div class="h_bqPage"><a href="javascript:void(0);" class="h_bqPage_left" class="h_bqPage">上页</a><a href="#" class="h_bqPage_right">下页</a></div>
               --%>
            </div>
          </li>
        </ul>
